package com.jlpay.openapi.demo.base;

import com.jlpay.open.jlpay.sdk.java.model.base.request.ListMccRequest;
import com.jlpay.open.jlpay.sdk.java.model.base.response.ListMccResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * MCC查询
 *
 * @author zhangyongfeng
 * @date 2025/7/21
 */
public class ListMccService {

    private static final Logger LOGGER = LoggerFactory.getLogger(ListMccService.class);

    public static void main(String[] args) {
        ListMccRequest request = buildRequest();
        ListMccResponse response = JlpayOpenApiService.openMerchService()
                .post(request, ListMccResponse.class);

        LOGGER.info("MCC查询响应:{}", JsonUtils.toString(response));
    }

    private static ListMccRequest buildRequest() {
        ListMccRequest request = new ListMccRequest();
        request.setMccLevel(3);
        request.setParentMcc("502");
        request.setSmallMerchant("0");
        request.setTopCode("05");
        request.setFreeFlag("0");
        request.setLimit(10);
        request.setOffset(0);
        return request;
    }
}
